package com.instance.demo5;

import java.beans.IntrospectionException;
import java.beans.PropertyDescriptor;

import com.instance.demo2.China;
import com.instance.demo2.Person;

public class person {
	private String tId;  
    
    private String id;

	public String gettId() {
		return tId;
	}

	public void settId(String tId) {
		this.tId = tId;
	}

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}   
	public static void main(String[] args) throws Exception {
		person p = new person();  
        p.setId("0");  
        PropertyDescriptor prop = new PropertyDescriptor("id", person.class);  
        prop.setDisplayName("ccc");
        prop.setPropertyEditorClass(Cla.class);
        prop.setValue("ad", 12);
        
        Class cls = prop.getPropertyEditorClass();
        Cla cla = null;
        cla = (Cla) cls.newInstance();
        
        
        // 获取getter方法，反射获取id值  
        Object str = prop.getReadMethod().invoke(p);  
  
        // 获取setter方法，反射赋值  
        prop.getWriteMethod().invoke(p, "1");  
        cla.say();
        System.out.println("获取ID值:" + str);  
        System.out.println("赋值ID:" + p.getId()+prop.getDisplayName()+prop.getValue("ad"));  
        
        String[] strs = "12_123_".split("_");
        System.out.println(strs.length);
	}
}
